home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / dlgdsn41.zip / READSCPT.H < prev    next >
C/C++ Source or Header  |  1993-08-03  |  5KB  |  158 lines

  1. #define MAXPARAM 6
  2. #define VersionID "SCRIPT1"
  3.  
  4. //various record types in the script file, used also to identify the type
  5. //of control
  6. enum recType {Dlg, Button, SText, CText, InputL, Labl, Histry, ILong, CheckB,
  7.               RadioB, MultiCB, ListB, Memo, ScrollB, Done = -1};
  8.  
  9. //various type of validators--not useful in C++ yet
  10. enum valType {Picture, Range, Filter, StringLookup, none = -1};
  11.  
  12. //the base struct.  Overridden by objects that read the script file and
  13. //again by objects that write source.  Contains data that is common to
  14. //the dialog and all controls.  Read operations will be accomplished by
  15. //the constructor, write operations by extensions to the methods.
  16. struct  ViewObj {
  17.     char *BaseObj,    //base object, like TInputLine
  18.          *Obj;        //actual class name, like TMyInputLine
  19.     int X1, Y1, X2, Y2,   //the TRect
  20.         DefOptns, Optns,  //default and actual options
  21.         DefEvMsk, EvMsk,  //default and actual eventMask
  22.         HCtx,             //helpCtx value
  23.         Grow;             //growMode
  24.     char *Param[MAXPARAM];   //possible 6 extra parameters
  25.     char *HelpCtxSym,        // like hcNoContext
  26.          *FieldName,         //name you entered for dataRec fieldname
  27.          *VarName;           //name you entered for variable name or 'control'
  28.  
  29.     ViewObj();
  30.     virtual void writeCode() {};
  31.     virtual void writeFields() {};
  32.     virtual void writeVars() {};
  33.     };
  34.  
  35. //the following objects will have their constructors defined to read the
  36. //script file.  They also contain fields special to the control type.
  37. struct DialogObj : ViewObj {    //the dialog itself
  38.    ushort Palette, WinFlags;
  39.    char *DlgFuncName,         //like makeDialog
  40.         *KeyString,           //ID string used when storing resource
  41.         *Title;               //dialog title
  42.    DialogObj();
  43.    };
  44.  
  45. struct ButtonObj : ViewObj {
  46.    char *CommandName,        //like cmOK
  47.         *ButtonText;         //like O~k~
  48.    ushort CommandValue,      //value for Command
  49.           Flags;
  50.    ButtonObj();
  51.    };
  52.  
  53. struct  StaticTextObj : ViewObj {
  54.    ushort Attrib;
  55.    char *Text;
  56.    StaticTextObj();
  57.    };
  58.  
  59. struct  ColoredTextObj : StaticTextObj {
  60.    ColoredTextObj() : StaticTextObj() {};
  61.    };
  62.  
  63.       // validator objects for TInputLine not used in C++ but which may be
  64.       //present in ascii file.
  65.       struct ValidatorObj {
  66.           ValidatorObj() {};
  67.           virtual void writeCode() {};
  68.           };
  69.       struct  PictureValidatorObj : ValidatorObj {
  70.      int AutoFill;
  71.      char *PictureString;
  72.          PictureValidatorObj();
  73.      };
  74.       struct  RangeValidatorObj : ValidatorObj {
  75.      long int LowLim, UpLim;
  76.      ushort Transfer;
  77.          RangeValidatorObj();
  78.      };
  79.       struct StringLookupValidatorObj : ValidatorObj {
  80.          char *List;
  81.          StringLookupValidatorObj();
  82.          };
  83.       struct FilterValidatorObj : ValidatorObj {
  84.          char *CharSet;
  85.          long ActualCharSet[8];  //represents actual character set
  86.          FilterValidatorObj();
  87.          };
  88.  
  89. struct  InputLineObj : ViewObj {
  90.    ushort StringLeng;       //AMaxLen parameter
  91.    char *ValPtrName;        //Class name of validator (not used in C++
  92.    ValidatorObj* val;
  93.    InputLineObj();
  94.    };
  95.  
  96. struct  InputLongObj : ViewObj {
  97.    char *LongLabelText;      //Text of label, used for error reporting
  98.    ushort LongStrLeng;       //AMaxLen parameter
  99.    long int LLim, ULim;
  100.    ushort ILOptions;
  101.    InputLongObj();
  102.    };
  103.  
  104. struct   LabelObj : ViewObj {
  105.    char *LabelText,
  106.         *LinkName;     //variable name of control to which label is linked
  107.    LabelObj();
  108.    };
  109.  
  110. struct  HistoryObj : ViewObj  {
  111.    ushort HistoryID;
  112.    char *HistoryLink;  //variable name of control to which history is linked
  113.    HistoryObj();
  114.    };
  115.  
  116. struct  ClusterObj : ViewObj   {   //basis for RadioButtons, CheckBoxes, MultiCheckBoxes
  117.    ushort Items;
  118.    long int Mask;     //enableMask, not used in C++
  119.    TStringCollection *LabelColl;   //collection of label names
  120.    ClusterObj();
  121.    };
  122. struct  RadioButtonObj : ClusterObj {
  123.    RadioButtonObj() : ClusterObj() {};
  124.    };
  125. struct  CheckBoxObj : ClusterObj {
  126.    CheckBoxObj() : ClusterObj() {};
  127.    };
  128. struct  MultiCheckBoxObj : ClusterObj {  //not useful in C++ yet
  129.    ushort MCBFlags;
  130.    int SelRange;
  131.    char *States;
  132.    MultiCheckBoxObj();
  133.    };
  134.  
  135. struct  ListBoxObj : ViewObj {
  136.    ushort Columns;
  137.    char *ScrollBar;    //variable name of attached scrollbar
  138.    ListBoxObj();
  139.    };
  140. struct  MemoObj : ViewObj {
  141.    char *TextFieldName;
  142.    ushort BufSize;
  143.    char *VScroll, *HScroll;
  144.    MemoObj();
  145.    };
  146. struct ScrollBarObj : ViewObj {
  147.    ScrollBarObj() : ViewObj() {};
  148.    };
  149.  
  150. extern TNSCollection *ScriptColl;  //all controls read are stored in this collection
  151. extern ViewObj* Dialog;   //the dialog itself is stored here
  152. extern Boolean present[ScrollB + 1];  //tells which Kinds are present
  153. extern TStringCollection *classCollection;  //a collection of all the Class names
  154.  
  155. ViewObj* getKind(recType Kind);
  156. void readScriptFile(char* scriptName);
  157. void checkMemory();
  158.